import 'package:flutter/foundation.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:syria_sports/core/app_export.dart';
import 'package:flutter/material.dart';
import 'package:syria_sports/data/models/auth/user.dart';
import '../../coaches/coach_profile_screen/coach_profile_screen.dart';


class PublicCoachItemView extends StatelessWidget {
  final User user;
  const PublicCoachItemView({super.key, required this.user});
  @override
  Widget build(BuildContext context) {
    return Card(
      color: Colors.white10,
      child: Padding(
        padding: const EdgeInsets.all(8.0),
        child: InkWell(
            onTap: (){
              Navigator.push(context, MaterialPageRoute(builder: (context) => CoachProfileScreen.builder(context, user)));
            },
            child:SizedBox(
              height: 200,
              width: 130,
              child: Column(
                children: [
                  if(user.image == null || user.image!.isEmpty)
                    Expanded(
                      child: Container(
                        width: 130,
                        decoration: BoxDecoration(
                          borderRadius: BorderRadius.circular(16),
                          border: Border.all(color: Colors.redAccent,width: 2),
                          image: DecorationImage(
                              image:Image.asset(ImageConstant.imgLogo).image
                          ),
                        ),
                      ),
                    )
                  else
                    Expanded(
                      child: Container(
                        width: 130,
                        decoration: BoxDecoration(
                          borderRadius: BorderRadius.circular(16),
                          border: Border.all(color: Colors.redAccent,width: 2),
                          image: DecorationImage(
                              fit: BoxFit.cover,
                              image:Image.network(user.image!).image
                          ),
                        ),
                      ),
                    ),
                  const SizedBox(width: 4),
                  Text(user.fullName,style: theme.textTheme.titleMedium),
                  Text(user.description??"لا يوجد وصف",style: CustomTextStyles.bodySmallOnPrimary),
                ],
              ),
            )
        ),
      ),
    );
  }

}
